package com.yexiao.cofe.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yexiao.cofe.business.pojo.Product;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    List<Product> listProduct(@Param("name") String name);

    void modifyProduct(@Param("productId") Integer productId,
                       @Param("name") String name,
                       @Param("description") String description,
                       @Param("categoryId") Integer categoryId,
                       @Param("basePrice") String basePrice,
                       @Param("image") String image,
                       @Param("sort") Integer sort);

    @Select("select * from product where product_id = #{productId}")
    Product getProduct(@Param("productId") Integer productId);

    @Delete("delete from product where product_id = #{productId}")
    void delByProductId(@Param("productId") Integer productId);
}
